package com.yao.factory;

import com.yao.factory.factory.AbstractFactory;
import com.yao.factory.factory.ColorFactory;
import com.yao.factory.factory.FactoryProducer;
import com.yao.factory.service.Color;
import com.yao.factory.service.Shape;

public class AbstractFactoryPatternDemo {

	public static void main(String[] args) {
		// get shape factory
		AbstractFactory shapeFactory = FactoryProducer.getFactory("SHAPE");

		// get an object of Shape Circle
		Shape shape1 = shapeFactory.getShape("CIRCLE");
		
//	    AbstractFactory colorFactory = FactoryProducer.getFactory("COLOR");
	    
	    
	    AbstractFactory colorFactory = FactoryProducer.getFactoryByClass(ColorFactory.class);
	    
	    Color red = colorFactory.getColor("red");
	    
	    red.fill();
	    
	    
	    AbstractFactory colorFactory1 =  FactoryProducer.getFactoryByClassName("com.yao.factory.factory.ColorFactory");
	}
}
